package com.zhentao.controller;

import com.github.pagehelper.PageInfo;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.model.pay.dto.PayDto;
import com.zhentao.model.pay.vo.PayVo;
import com.zhentao.service.ApUserPaymentOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("api/v1/admin/pay/order")
@Api(tags = "OrderController-充值订单管理")
public class OrderController {

    @Resource
    ApUserPaymentOrderService paymentOrderService;

    /**
     * 用户充值订单列表
     * @param dto
     * @return
     */
    @PostMapping("/list")
    @ApiOperation("用户充值订单列表")
    public ResponseResult list(@RequestBody PayDto dto){
        PageInfo<PayVo> list = paymentOrderService.getList(dto);
        return ResponseResult.okResult(list);
    }

    /**
     * 用户个人充值订单情况
     * @param userId
     * @return
     */
    @PostMapping("/selectOrderByUserId/{userId}")
    @ApiOperation("用户个人充值订单情况")
    public ResponseResult orderlist(@PathVariable("userId") Integer userId){
        return paymentOrderService.orderlist(userId);
    }
}
